// 引入
import request from '@/utils/request.ts'
import qs from 'qs'
import { StudentListType } from './type/index.ts'


// 使用枚举包含所有的path
enum Api {
  // 获取学生信息列表
  getStudentList = '/api/getStudentList',
  // 删除学生信息
  delStudent = '/api/delStudent',
  // 新增学生信息
  addStudent = '/api/addStudent',
  // 修改学生信息
  editStudent = '/api/editStudent'
}


// 获取学生信息列表的Api
export const getStudentListApi = () => {
  return request.get<any, StudentListType>(Api.getStudentList)
}


// 删除学生信息的Api
export const delStudentApi = (data: { id: number }) => {
  return request.post(Api.delStudent, data)
}

// 新增学生信息的Api
export const addStudentApi = (data: { studentName: string, age: number, sex: string, phone: string, address: string }) => {
  return request.post(Api.addStudent, data)
}
// 修改学生信息的Api
export const editStudentApi = (data: { id: number, studentName: string, age: number, sex: string, phone: string, address: string }) => {
  return request.post(Api.editStudent, data)
}